﻿using System;
using System.Collections.Generic;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Text;

namespace Ch.Admin.Bfs.Sms.Sdmx.Extension.CodeBook.Pdf
{
    public class PdfFonts
    {
        #region Constants

        public int COLOR_TABLE_GREY = 0xDDDDDD;
        public int COLOR_TABLE_HEAD = 0x07A1E2;
        public int COLOR_TABLE_ALTERNED = 0xABD2F4;

        #endregion

        #region Properties
        /// <summary>All different fonts used</summary>
        public Font FontTitle { get; private set; }
        public Font FontLevelOne { get; private set; }
        public Font FontTableHead { get; private set; }
        public Font FontLevelTwo { get; private set; }
        public Font FontStandard { get; private set; }
        public Font FontStandardWhite { get; private set; }
        public Font FontProperty { get; private set; }
        public Font FontPropertyItalic { get; private set; }

        public Font FontImpressumTitle { get; private set; }
        public Font FontImpressumConcept { get; private set; }
        public Font FontImpressumValue { get; private set; }


        public Font FontCoverHeadOfs { get; private set; }
        public Font FontCoverHead { get; private set; }
        public Font FontCoverTitle { get; private set; }
        public Font FontCoverSubTitle { get; private set; }

        #endregion


        public PdfFonts(string fontDirectory)
        {
            try
            {
                BaseFont bfArial = BaseFont.CreateFont(fontDirectory + @"\arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                BaseFont bfArialBold = BaseFont.CreateFont(fontDirectory + @"\arialbd.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                BaseFont bfSyntaxLTStd_Bold = BaseFont.CreateFont(fontDirectory + @"\SyntaxLTStd-Bold.otf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                BaseFont bfSyntaxLTStd_Italic = BaseFont.CreateFont(fontDirectory + @"\SyntaxLTStd-Italic.otf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                BaseFont bfSyntaxLTStd_Roman = BaseFont.CreateFont(fontDirectory + @"\SyntaxLTStd-Roman.otf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

                FontTitle = new Font(bfSyntaxLTStd_Bold, 24f, Font.NORMAL, new BaseColor(COLOR_TABLE_ALTERNED));
                FontLevelOne = new Font(bfSyntaxLTStd_Bold, 9.5f, Font.NORMAL, new BaseColor(0xFFFFFF));
                FontTableHead = new Font(bfSyntaxLTStd_Roman, 9.5f, Font.NORMAL);
                FontLevelTwo = new Font(bfSyntaxLTStd_Bold, 9.5f, Font.NORMAL, new BaseColor(COLOR_TABLE_HEAD));
                FontStandard = new Font(bfSyntaxLTStd_Roman, 9.5f, Font.NORMAL);
                FontStandardWhite = new Font(bfSyntaxLTStd_Roman, 9.5f, Font.NORMAL, new BaseColor(0xFFFFFF));
                FontProperty = new Font(bfSyntaxLTStd_Bold, 9.5f, Font.NORMAL);
                FontPropertyItalic = new Font(bfSyntaxLTStd_Italic, 9.5f, Font.NORMAL);

                FontImpressumTitle = new Font(bfSyntaxLTStd_Bold, 9.5f, Font.NORMAL);
                FontImpressumConcept = new Font(bfSyntaxLTStd_Roman, 7f, Font.BOLD);
                FontImpressumValue = new Font(bfSyntaxLTStd_Roman, 7f, Font.NORMAL);

                FontCoverHead = new Font(bfArial, 7f, Font.NORMAL);
                FontCoverHeadOfs = new Font(bfArialBold, 7f, Font.NORMAL);
                FontCoverTitle = new Font(bfArialBold, 21f, Font.NORMAL);
                FontCoverSubTitle = new Font(bfArialBold, 10f, Font.NORMAL);


            }
            catch (Exception ex)
            {
                throw new ApplicationException("Unable to obtains required fonts.", ex);
            }

       
        }
    }
}
